﻿using SqlSugar;
using System.Linq.Expressions;

namespace WareHouse.Repositories
{
    public interface IBaseRepository<TEntity> where TEntity : class, new()
    {
        Task<TEntity> FistAsync(Expression<Func<TEntity, bool>> predicate);
        Task<long> InsertAsync(TEntity entity);
        Task<List<TEntity>> QueryAsync();
        Task<List<TEntity>> QueryAsync(Expression<Func<TEntity, bool>> expression);
        Task<TEntity> UpdateAsync(TEntity entity);
        /// <summary>
        /// 分页方法
        /// </summary>
        /// <param name="PageIndex"></param>
        /// <param name="PageSize"></param>
        /// <param name="expression"></param>
        /// <returns></returns>
        Task<(int, List<TEntity>)> PageAsync(int PageIndex, int PageSize, Expression<Func<TEntity, bool>> expression);
        //单个逻辑删除
        Task<int> Delete(long ids);
        Task<long> DeleAsync(long id);
        Task<long> DeleAsyncList1(string id);
    }
}